﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin-One-Column.master" AutoEventWireup="true" CodeBehind="QuanLiKhachHang.aspx.cs" Inherits="BookStore.admin.QuanLiKhachHang" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BreadcrumbsContent" runat="server">
<h1>Quản Lí Khách Hàng</h1>
<br />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainColumnContent" runat="server">

<br />
    <div id="admin-table">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" CellPadding="4" DataKeyNames="MaKhachHang" 
            DataSourceID="SqlDataSource1" 
            EmptyDataText="There are no data records to display." ForeColor="#333333" 
            GridLines="None" PageSize="5" Width="954px">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="MaKhachHang" 
                    DataNavigateUrlFormatString="~/admin/KhachHang.aspx?MaKhachHang={0}" 
                    DataTextField="MaKhachHang" HeaderText="Mã Khách Hàng" />
                
                <asp:BoundField DataField="TenKhachHang" HeaderText="Tên Khách Hàng" 
                    SortExpression="TenKhachHang" />
                <asp:BoundField DataField="DiaChi" HeaderText="Địa Chỉ" 
                    SortExpression="DiaChi" />
                <asp:BoundField DataField="DienThoai" HeaderText="Điện Thoại" 
                    SortExpression="DienThoai" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ButtonType="Image" CancelImageUrl="~/images/cross.png" 
                DeleteImageUrl="~/images/cross.png" EditImageUrl="~/images/pencil.png" 
                UpdateImageUrl="~/images/check.png" />
            </Columns>
            <EditRowStyle BackColor="#7C6F57" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
            <PagerStyle CssClass="pagination" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
            DeleteCommand="DELETE FROM [KhachHang] WHERE [MaKhachHang] = @MaKhachHang" 
            InsertCommand="INSERT INTO [KhachHang] ([UserID], [TenKhachHang], [DiaChi], [DienThoai], [Email]) VALUES (@UserID, @TenKhachHang, @DiaChi, @DienThoai, @Email)" 
            ProviderName="<%$ ConnectionStrings:ApplicationServices.ProviderName %>" 
            SelectCommand="SELECT [MaKhachHang], [UserID], [TenKhachHang], [DiaChi], [DienThoai], [Email] FROM [KhachHang]" 
            UpdateCommand="UPDATE [KhachHang] SET [UserID] = @UserID, [TenKhachHang] = @TenKhachHang, [DiaChi] = @DiaChi, [DienThoai] = @DienThoai, [Email] = @Email WHERE [MaKhachHang] = @MaKhachHang">
            <DeleteParameters>
                <asp:Parameter Name="MaKhachHang" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="UserID" Type="Object" />
                <asp:Parameter Name="TenKhachHang" Type="String" />
                <asp:Parameter Name="DiaChi" Type="String" />
                <asp:Parameter Name="DienThoai" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="UserID" Type="Object" />
                <asp:Parameter Name="TenKhachHang" Type="String" />
                <asp:Parameter Name="DiaChi" Type="String" />
                <asp:Parameter Name="DienThoai" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="MaKhachHang" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
 </div>
</asp:Content>
